// logs.js

Page({
  data: {
    id: "",
    logs: [],
    value: "",
    data: [],
    a: "",
    proinfo: {},
    pageNum: 1,
    pageSize: 500
  },
  onLoad(options) {
    console.log(options);
    if (options.id) {
      this.setData({
        id: options.id
      })
      this.getlist()
    }
  },
  click(event) {
    console.log(event);
    wx.navigateTo({
      url: `/sub_renyuanguanli/renyuanlist/renyuanlist?id=${event.currentTarget.dataset.id}&grade=2&shortname=${event.currentTarget.dataset.shortname}`,
    })
    // var _this = this
    // // console.log(event.currentTarget.id)
    // console.log(event.currentTarget.dataset.proinfo);
    // _this.setData({
    //   value: event.currentTarget.id,
    //   proinfo: event.currentTarget.dataset.proinfo,
    // })
    // this.botton()
  },
  botton() {
    var _this = this
    getApp().globalData.seleproinfo = this.data.proinfo
    wx.navigateBack({ //返回
      delta: 1
    })
  },
  valueChange(e) {
    if (e.detail.length == 0) {
      this.setData({
        data: [],
        pageNum: 1
      })
    }
  },
  onChange(event) {
    var _this = this
    _this.setData({
      value: event.detail,
      pageNum: 1
    })

      wx.showLoading({
        title: '搜索中',
      })
      let prams = {
        bankName:this.data.value,
        bankId: this.data.id,
        pageNum: this.data.pageNum,
        pageSize: this.data.pageSize,
      }
      getApp().globalData.request('/corpVisit/queryDescendantNodes', prams, "POST", ).then(res => {
        console.log("++++++++", res);
        wx.hideLoading()
        _this.setData({
          data: res.data
        })
      })

  },
  getlist() {
    var _this = this
    // if (_this.data.value.length >= 4) {
    wx.showLoading({
      title: '搜索中',
    })
    let prams = {
      bankName:this.data.value,
      bankId: this.data.id,
      pageNum: this.data.pageNum,
      pageSize: this.data.pageSize,
    }
    getApp().globalData.request('/corpVisit/queryDescendantNodes', prams, "POST", ).then(res => {
      console.log("++++++++", res);
      wx.hideLoading()
      _this.setData({
        data: res.data
      })
    })
    console.log(this.data.data);
    // }

  },
  onReachBottom() {
    // console.log(11);
    // this.setData({
    //   pageNum: ++this.data.pageNum
    // })
    // this.getlist()
  },

})